package com.yunhe.java.day05;

/**
 * Created by Administrator on 2017/7/25 0025.
 */
public class Arr {
    public static void main(String[] args) {
       int  arr[] = {1,2,3,3,5,8,9,12,8,4,3};
       int a=suoYin(arr,8);
        System.out.println(a);
    }
    public static int  suoYin(int [] arr ,int target) {
        int index = -2;
        int n = 0;
        for (int i = 0; i < arr.length; i++) {

            if (arr[i] == target) {
                index = i;
               break;
            }
        }
            return index;
    }
}
